import { defineConfig } from 'vite'
import vueJsx from "@vitejs/plugin-vue-jsx"
import { resolve } from 'path'
import createVitePlugins from './vite/plugins'

export default defineConfig( {
    plugins: [vueJsx(), createVitePlugins()],
    resolve: {
      alias: {
        '@': resolve(__dirname, 'src'),
        components: resolve(__dirname, 'src/components')
      },
      extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.mjs']
    },
    server: {
      port: 8080,
      host: true,
      open: true,
      proxy: {
        '/dev-api': {
          target: 'https://mock.mengxuegu.com/mock/66a73841904326081fb3c23c',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/dev-api/, '')
        }
      }
    }
})
